import Vue from 'vue';
import VueRouter from 'vue-router'

import Interface from './../view/Interface.vue';

// 程学飞的路由
import QuHydtj from './../view/cxf+sjtj/QuHydtj.vue';
import QuXstj from './../view/cxf+sjtj/QuXstj.vue';
import ShengHydtj from './../view/cxf+sjtj/ShengHydtj.vue';
import ShengXstj from './../view/cxf+sjtj/ShengXstj.vue';
import ShiHydtj from './../view/cxf+sjtj/ShiHydtj.vue';
import ShiXstj from './../view/cxf+sjtj/ShiXstj.vue';
import Sjtj from './../view/cxf+sjtj/Sjtj.vue';

//李自的路由
import Card from './../view/lizi+card/CardManage'

//成成的路由
import Dakehu from './../view/scc+VIP/Dakehu.vue';
import Orderlist from './../view/scc+VIP/Orderlist.vue';
import Setup from './../view/scc+VIP/Setup.vue';

//王军的路由
import Caidan from './../view/wj+xitong/Caidan.vue';
import Jiaoshe from './../view/wj+xitong/Jiaoshe.vue';
import Quanxian from './../view/wj+xitong/Quanxian.vue';
import Renyuan from './../view/wj+xitong/Renyuan.vue';

//陈利的路由
import CheckList from './../view/cl+cwgl/CheckList.vue';
import OrderList from './../view/cl+cwgl/OrderList01.vue';
import WalletList from './../view/cl+cwgl/WalletList.vue';
import Withdraw from './../view/cl+cwgl/WithdrawDepositList.vue';

//张祥瑞的路由
import Login from './../view/zxr+login/Login.vue';


Vue.use(VueRouter)

// 定义路由配置表
var routes=[
    {path:'/',redirect:'/login'},
    // 登录调用
    {path:'/login',component:Login,meta:{key:false}},
    //主界面
    {path:'/interface',
    component:Interface,
    redirect:'/interface/Sjtj',
    //路由守卫
    beforeEnter: (to, from, next) => {
        console.log(from)
        if(from.path =="/login" && from.meta.key=="true")
        {
            console.log(3333);
            // router.push(to).catch(err => { console.log(err) });
            next();
        }else{
            console.log(222);
            router.push('/login').catch(err => { console.log(err) });
            next();
        }
    },


    children:[
    // 程学飞的调用
    {path:'/interface/QuHydtj',component:QuHydtj},
    {path:'/interface/QuXstj',component:QuXstj},
    {path:'/interface/ShengHydtj',component:ShengHydtj},
    {path:'/interface/ShengXstj',component:ShengXstj},
    {path:'/interface/ShiHydtj',component:ShiHydtj},
    {path:'/interface/ShiXstj',component:ShiXstj},
    {path:'/interface/Sjtj',component:Sjtj},

    //李自的路由代用
    {path:'/interface/card',component:Card},

    //成成的调用
    {path:'/interface/Dakehu',component:Dakehu},
    {path:'/interface/Orderlist',component:Orderlist},
    {path:'/interface/Setup',component:Setup},

    // 王军的调用
    {path:'/interface/Caidan',component:Caidan},
    {path:'/interface/Jiaoshe',component:Jiaoshe},
    {path:'/interface/Quanxian',component:Quanxian},
    {path:'/interface/Renyuan',component:Renyuan},

    // 陈利的调用
    {path:'/interface/CheckList',component:CheckList},
    {path:'/interface/OrderList01',component:OrderList},
    {path:'/interface/WalletList',component:WalletList},
    {path:'/interface/Withdraw',component:Withdraw},
    ]},
]


// 创建路由实例
var router=new VueRouter({
    routes
})

// 导出实例对象
export default router  